/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package contoladores;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Vector;

import modelos.MIngrediente;
import vista.VListadoIngredientes;

/**
 *
 * @author usuario
 */
public class CListadoIngrediente implements ActionListener {
    private VListadoIngredientes vista;
    private MIngrediente modelo;
    public CListadoIngrediente(VListadoIngredientes aThis) {
        vista= aThis;
        modelo= new MIngrediente();
        consultar();
        vista.addListener(this);
    }

    private void consultar() {
    	   vista.getModeloTabla().setRowCount(0);
           Vector<MIngrediente> v = modelo.listar();
           for (int i = 0; i < v.size(); i++)
        	   vista.agregar(v.get(i));
		
	}

	public void actionPerformed(ActionEvent ae) {
		vista.hide();
    }

}
